home *** CD-ROM | disk | FTP | other *** search
- /*
- File: CntxtOSL.h
-
- Contains: Additions to the OSL interface for OpenDoc support.
-
- Owned by: Nick Pilch
-
- Copyright: © 1993 - 1995 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <10> 8/29/95 jpa DescPtr --> AEDesc* for Univ Hdrs 2.1.
- [1279173]
- <9> 6/27/95 NP 1262792: new version of OSLObjectInit
- <8> 5/25/95 jpa Use #pragma import [1241078]
- <7> 2/22/95 eeh 1222904: fix def of SetCurrentContext
- <6> 1/25/95 eeh 1214783: fix def of kSwitchDescType
- <5> 1/9/95 NP 1194880: private data change requested by
- documentation.
- <4> 11/15/94 NP 1196322-made functions non-pascal.
- <3> 9/29/94 RA 1189812: Mods for 68K build.
- <2> 8/19/94 NP 1181622: Ownership fix.
- <1> 6/24/94 NP first checked in
- <13> 5/2/94 eeh bug #1160654: various PPC native changes
- <12> 2/9/94 NP Tiger Team cleanup.
- <11> 2/7/94 NP Tiger Team doings.
- <10> 10/22/93 NP Added OSLCallObjectAccessor.
- <9> 10/18/93 NP Interface tweaks.
- <8> 10/11/93 NP Type name and parameter name tweaks.
- <7> 9/24/93 JA Minor syntactic tweaks for THINK C++.
- <6> 9/20/93 NP Added GetCurrentContext and
- SetCurrentContext.
- <5> 9/3/93 NP Added "switch" descriptor type.
- <4> 8/19/93 NP Changed const error code to a #define.
- <3> 8/18/93 NP Mods for new context scheme.
- <2> 8/16/93 NP Added constant.
- <1> 8/16/93 NP first checked in
-
- To Do:
- In Progress:
- */
-
- /*———————————————————————————————————————————————————————————————————————————————————*/
- /*
- ©Apple Computer, Inc. 2/21/91
- All Rights Reserved.
-
- */
-
- #ifndef _CNTXTOSL_
- #define _CNTXTOSL_
-
- #ifndef __AEOBJECTS__
- #include <AEObjects.h>
- #endif
-
- #define errNoDataHandle = -1731;
-
- enum
- {
- kSwitchDescType = 0x73776170 // 'swap'
- };
-
- /************ Contexts ***************/
-
- enum OSLCallbackSelector
- {
- kCallbackFlagsGetter,
- kObjectAccessor,
- kCompareProc,
- kCountProc,
- kDisposeTokenProc,
- kMarkProc,
- kGetMarkTokenProc,
- kAdjustMarksProc,
- kGetErrDescProc
- };
- typedef enum OSLCallbackSelector OSLCallbackSelector;
-
- typedef ProcPtr CallbackCallerProc;
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- typedef
- CallbackCallerProc (*GetCallbackCallerProc)(OSLCallbackSelector whichCallback);
-
- #ifdef __cplusplus
- }
- #endif
-
- struct OSLContext
- {
- GetCallbackCallerProc getCallerProc;
- long refCon;
- };
- typedef struct OSLContext OSLContext;
-
- /************ Tokens ***************/
-
- typedef AEDesc OSLToken;
-
- struct ContainedTokenRecord
- {
- DescType tokenClass;
- OSLToken token;
- };
- typedef struct ContainedTokenRecord ContainedTokenRecord, *ContainedTokenRecPtr,
- **ContainedTokenRecHandle;
-
- /************ CallbackCallerProc real types ***************/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- typedef long (*CallbackFlagsGetter)(long contextRefCon);
-
- typedef OSErr (*ObjectAccessorCaller)(DescType desiredClass,
- const OSLToken* containerToken,
- DescType containerClass,
- DescType keyForm,
- const AEDesc* keyData,
- OSLToken* value,
- Boolean* procFound,
- long contextRefCon);
-
- typedef OSErr (*CompareProcCaller)(DescType oper,
- const OSLToken* obj1,
- const OSLToken* obj2,
- Boolean* result,
- long contextRefCon);
-
- typedef OSErr (*CountProcCaller)(DescType desiredType,
- DescType containerClass,
- const OSLToken* container,
- long* result,
- long contextRefCon);
-
- typedef OSErr (*DisposeTokenProcCaller)(OSLToken* unneededToken,
- long contextRefCon);
-
- typedef OSErr (*GetMarkTokenProcCaller)(const OSLToken* dContainerToken,
- DescType containerClass,
- OSLToken* result,
- long contextRefCon);
-
- typedef OSErr (*GetErrDescProcCaller)(AEDesc** appDescPtr,
- long contextRefCon);
-
- typedef OSErr (*MarkProcCaller)(const OSLToken* dToken,
- const OSLToken* markToken,
- long index,
- long contextRefCon);
-
- typedef OSErr (*AdjustMarksProcCaller)(long newStart,
- long newStop,
- const OSLToken* markToken,
- long contextRefCon);
-
- #ifdef __cplusplus
- }
- #endif
-
- /* typedefs providing type checking for procedure pointers */
- #if 0
- typedef pascal OSErr (*OSLAccessorProcPtr) ( DescType desiredClass,
- const OSLToken *container, DescType containerClass, DescType form,
- const AEDesc *selectionData, OSLToken *value, long LongInt ) ;
-
- typedef pascal OSErr (*OSLCompareProcPtr)( DescType oper, const OSLToken *obj1,
- const OSLToken *obj2, Boolean *result ) ;
- typedef pascal OSErr (*OSLCountProcPtr)( DescType desiredType,
- DescType containerClass,
- const OSLToken *container,
- long *result ) ;
- typedef pascal OSErr (*OSLDisposeTokenProcPtr)( OSLToken *unneededToken ) ;
-
- typedef pascal OSErr (*OSLGetMarkTokenProcPtr)( const OSLToken *dContainerToken,
- DescType containerClass,
- OSLToken *result ) ;
-
-
- typedef pascal OSErr (*OSLGetErrDescProcPtr)( AEDesc* *appDescPtr ) ;
-
- /* Note: app is supposed to dispose of dToken after marking */
- typedef pascal OSErr (*OSLMarkProcPtr)( const OSLToken *dToken,
- const OSLToken *markToken, long index ) ;
- typedef pascal OSErr (*OSLAdjustMarksProcPtr)( long newStart, long newStop,
- const OSLToken *markToken ) ;
- #endif /* 0 */
-
-
- /*——————————————————————————————— PUBLIC PROCEDURES —————————————————————————————————*/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #ifdef _PLATFORM_MACINTOSH_
- #pragma import on
- #endif
-
- OSErr OSLObjectInit( OSLContext* context ) ;
- /* Not done by inline, but by direct linking into code. It sets up the pack
- such that further calls can be via inline */
-
-
- OSErr OSLResolve ( const AEDesc *objectSpecifier,
- OSLToken *theToken,
- OSLContext* startingContext);
-
- OSErr OSLDisposeToken( OSLToken *theToken );
-
- OSErr OSLCallObjectAccessor(DescType desiredClass,
- const AEDesc *containerToken,
- DescType containerClass,
- DescType keyForm,
- const AEDesc *keyData,
- AEDesc *token);
-
- OSErr GetCurrentContext( OSLContext* curContext );
- OSErr SetCurrentContext( OSLContext* curContext );
-
- #ifdef __cplusplus
- }
- #endif
-
- #ifdef _PLATFORM_MACINTOSH_
- #pragma import off
- #endif
-
-
- /*
- Here are the interfaces your callback procs must be written to:
-
- pascal OSErr MyCompareProc( DescType comparisonOperator,
- const OSLToken *theObject, const OSLToken *descOrObj,
- Boolean *result ) ;
- pascal OSErr MyCountProc( DescType desiredType, DescType containerClass,
- const OSLToken *container, long *result: ) ;
- pascal OSErr MyGetMarkToken( const OSLToken *containerToken,
- DescType containerClass, OSLToken *result ) ;
- pascal OSErr MyMark( const OSLToken *theToken , const OSLToken *markToken,
- long markCount ) ;
- pascal OSErr MyAdjustMarks( long newStart, long newStop,
- const OSLToken *markToken ) ;
- pascal OSErr MyDisposeToken( OSLToken *unneededToken ) ;
- pascal OSErr MyGetErrDesc( AEDesc* *appDescPtr ) ;
-
- pascal OSErr MyObjectAccessor( DescType desiredClass,
- const OSLToken *containerToken,
- DescType containerClass, DescType keyForm,
- const AEDesc *keyData, OSLToken *theToken,
- long *theRefcon ) ;
-
- You'll probably want to have a number of these last ones.
- A proc that finds a line within a document should be installed with 'line' and 'docu'
- as the desiredClass and containerClass fields in the call to AEInstallObjectHandler().
- */
-
- #endif /* _CNTXTOSL_ */
-